<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>数据权限</title> 
    <link href="${root}/js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="${root}/js/lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
    <script src="${root}/js/lib/jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="${root}/js/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>   
    <link href="${root}/js/lib/css/common.css" rel="stylesheet" type="text/css" />  
    <script src="${root}/js/common/common.js" type="text/javascript"></script>   
    <script src="${root}/js/common/LG.js" type="text/javascript"></script>
    <script src="${root}/js/common/ligerui.expand.js" type="text/javascript"></script> 
    <script src="${root}/js/lib/json2.js" type="text/javascript"></script>
    <script src="${root}/js/common/DataPrivilageSysParm.js" type="text/javascript"></script> 
    <style type="text/css">
    .filterpanle{ margin:10px;}
    .l-panel td.l-filter-column,.l-panel td.l-filter-value,.l-panel td.l-filter-op{ padding:2px;}
    
    .l-selected .l-grid-row-cell, .l-selected {background: #F5F5F5;}
    .l-panel td .l-filter-rowlast{ padding-top:1px;}
    
    .l-panel td .l-filter-rowlast {padding:3px;}
        .l-panel td .groupopsel{ margin:1px;}
        .l-panel td .l-filter-cellgroup{ padding:2px;}  
         .l-panel td .l-filter-rowlastcell{ padding:2px;}
    </style>
</head>
<body style="padding:10px;height:100%; text-align:center;">
   <ipnut type="hidden" id="MenuNo" value="sysDataPrivilege" />
  <div id="mainsearch" style=" width:98%"> 
  <div id="maingrid"></div> 
  <script type="text/javascript">
      var DbViews = ''<%//=LigerRM.Service.Setting.DbSettingHelper.GetSettingsJSON() %>;  


      //相对路径
      var rootPath = "${root}/app/";
      //列表结构
      var toolbarOptions = {
          items: [
            { text: '增加', id: 'add', click: toolbarBtnItemClick, img: "${root}/js/lib/icons/silkicons/add.png" },
            { line: true },
            { text: '修改', id: 'modify', click: toolbarBtnItemClick, img: "${root}/js/lib/icons/miniicons/page_edit.gif" },
            { line: true },
            { text: '删除', id: 'delete', click: toolbarBtnItemClick, img: "${root}/js/lib/icons/miniicons/page_delete.gif" },
            { line: true },
            { text: '查看', id: 'view', click: toolbarBtnItemClick,icon:'save' }
        ]
      };
      var grid = $("#maingrid").ligerGrid({
          columns: [
          { display: "名称", name: "name", width: 150, type: "text", align: "left" },
          { display: "类型", name: "isPublie", width: 150, type: "text", align: "left" },
          { display: "描述", name: "remark", width: '100%', type: "text", align: "left" }
          ], 
          dataAction: 'server', 
          pageSize: 20, 
          toolbar: toolbarOptions,
          url: rootPath + 'sys_rule_loadJSON', 
          sortName: 'name', 
          width: '98%', 
          height: '100%',
          heightDiff:-10, 
          checkbox: false,
          usePager:true,
          enabledEdit: false, 
          clickToEdit: false,
          mouseoverRowCssClass : null,
          alternatingRow :false
      }); 
	
      //工具条事件
      function toolbarBtnItemClick(item) {
          switch (item.id) {
              case "add":
                  top.f_addTab(null, '增加规则', '${root}/jsp/systemManager/dataManager/dataPrivilegeDetail.jsp?IsView=0&ID=0');
                  break;
              case "view":
                  var selected = grid.getSelected();
                  if (!selected) { LG.tip('请选择行!'); return; }
                  top.f_addTab(null, '查看规则', '${root}/jsp/systemManager/dataManager/dataPrivilegeDetail.jsp?IsView=1&ID=' + selected.rule_id);
                  break;
              case "modify":
                  var selected = grid.getSelected();
                  if (!selected) { LG.tip('请选择行!'); return; }
                  top.f_addTab(null, '修改规则', '${root}/jsp/systemManager/dataManager/dataPrivilegeDetail.jsp?IsView=0&ID=' + selected.rule_id);
                  break;
              case "delete":
                  jQuery.ligerDialog.confirm('确定删除吗?', function (confirm) {
                      if (confirm)
                          f_delete();
                  });
                  break;
          }
      }

      function f_reload() {
          grid.loadData();
      }
      function f_delete() {
          var selected = grid.getSelected();
          if (selected) {
              LG.ajax({
                  type: '/sys_rule_remove',
                 // method: '/sys_obj_remove',
                  loading: '正在删除中...',
                  data: { ID: selected.rule_id },
                  success: function () {
                      LG.showSuccess('删除成功');
                      f_reload();
                  },
                  error: function (message) {
                      LG.showError(message);
                  }
              });
          }
          else {
              LG.tip('请选择行!');
          }
      }

	
  </script>
</body>
</html>
